<?php

namespace app\common\model;

/**
 * [GoodsIlike  商品收藏表]
 * @author [C。]
 * @return html
 */
class GoodsIlike extends Base
{
    protected $name = 'goods_ilike';
    /**
     * 根据搜索条件获取寺院列表信息
     */
    public function getlist($map,$from = 0, $size = 5)
    {
        $join = [
            ['app_goods g','g.id = gi.goodsid'],
        ];
        $order = ['gi.id' => 'desc'];
        $result =  $this->field('g.id,g.title,g.cover')
            ->alias('gi')
            ->join($join)
            ->where($map)
            ->order($order)
            ->limit($from, $size)
            ->select();
        return $result;
    }
    /**
     * 根据条件获取总数
     * @param array $param
     */
    public function getCount($map) {
        $join = [
            ['app_goods g','g.id = gi.goodsid'],
        ];
        $result =  $this
            ->alias('gi')
            ->join($join)
            ->where($map)
            ->count();
        return $result;
    }
}